package scala.objectoriented

//  (2) 如果想让主构造器变成私有的，可以在()之前加上private
class PersonApply private(Cname: String) {
  var name: String = Cname
}

object PersonApply {
  def apply(): PersonApply = {
    println("apply空参被调用")
    new PersonApply("song")
  }

  def apply(name: String): PersonApply = {
    println("apply有参调用")
    new PersonApply(name)
  }
}

